home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-07 / book.exe / LAN.H < prev    next >
C/C++ Source or Header  |  1991-09-02  |  5KB  |  161 lines

  1. /*
  2. // LAN.H    Header file for LAN utility. Included in all modules.
  3. //
  4. // (c) Copyright 1991 Adrian King.
  5. //
  6. //
  7. //        This code was developed for inclusion in the book
  8. //        "Running LANtastic", by Adrian King, published by
  9. //        Bantam Books, October 1991.
  10. //
  11. // $Header:   F:/LANBOOK/SRC/LAN/VCS/LAN.H_V   1.0   13 Jul 1991 11:19:12  $
  12. //
  13. // $Log:   F:/LANBOOK/SRC/LAN/VCS/LAN.H_V  $
  14. //
  15. //   Rev 1.0   13 Jul 1991 11:19:12
  16. //Initial revision.
  17. //
  18. */
  19.  
  20.     // Error codes 
  21.  
  22. #define    E_NOLANLIB        1
  23. #define E_LANLIBL        2
  24. #define E_NOVECTOR        3
  25. #define E_NONETBIOS        4
  26. #define    E_NONOS            5
  27. #define    E_GETNAME        6
  28. #define E_GETMSGVEC        7
  29. #define    E_SETMSGFLAG    8
  30. #define    E_SETMSGVEC        9
  31. #define E_NONCB            10
  32. #define    E_NOLAN            11
  33. #define E_NOHOST        12
  34. #define E_GETMSGFLAG    13
  35. #define    E_GORES            14
  36. #define E_NONAME        15
  37. #define E_GETDOSVEC        16
  38. #define E_SETDOSVEC        17
  39. #define E_MSGERR        18
  40.  
  41. extern char *LANerr[];                    // Error message table
  42.  
  43. extern int NOSerrno;                    // Holds most recent NOS error
  44.  
  45.     // External shared routines
  46.  
  47. extern void FATAL();         // Error reporters
  48. extern void FATALN();
  49. extern void lanlibcheck();  // Check resident library is loaded
  50. extern int  sendmessage();    // Send a LAN message
  51. extern void delay();        // Wait a specified time
  52.                             // Copy a far buffer to a near place
  53. extern void copyfartonear(char far *, char *, int);
  54. extern void refreshnames();    // Update names of machines currently on the LAN
  55. extern int  addname();        // Add a single name to LAN table
  56. extern void gennrsl();        // Generate NRSL descriptive string
  57. extern void initnodetable();// Set up empty network node table
  58. extern int  nodenamecmp();    // Compare network node names
  59. extern void far entercrit();// Enter a critical region
  60. extern void far leavecrit();// Leave a critical region
  61.                             // Message processing routine
  62. extern void far msg_proc(struct message_buffer far *);
  63.  
  64.     // Miscellaneous constants 
  65.  
  66. #define FALSE        0
  67. #define TRUE        1
  68. #define    D_TIMEOUT    30        // Default 30 sec timeout when waiting to sync
  69.                             // with another host 
  70. #define    D_DISPTICKS    182        // Display message for this # of ticks (10 secs)
  71. #define D_DISPLINE  12        // Display message on this line
  72. #define D_NODES        16        // Maximum # of nodes that we'll remember 
  73. #define D_lanbios    0x80    // NOSPresence() bit definitions
  74. #define D_server    0x40
  75. #define D_redir        0x08
  76. #define D_lanpup    0x02
  77.  
  78.     //
  79.     // Each entry in the workq structure holds information about the 
  80.     // next item of work that must be done by the dowork() routine 
  81.     // in LANRES.C
  82.     //
  83.  
  84. struct workq {                // Definition of work to be done
  85.     struct workq *cpW;        // Pointer to next work queue item
  86.     WORD wType;                // Type of work to be done.
  87.                             // 0 => unused entry
  88.     struct message_buffer M;// Copy of received message
  89. };
  90.  
  91.     // Routines to manipulate work queue entries
  92.  
  93. extern void freework();                // Free work queue item
  94. extern struct workq *allocwork();    // Allocate an item
  95. extern struct workq *nextwork();    // Get next work item
  96. extern void initwork();                // Initialize work queue
  97.  
  98.     //
  99.     // The work queue and msg stats structure only exist within LANRES.
  100.     //
  101.     // The msg stats structure collects information about message traffic
  102.     //
  103.  
  104. #ifdef BACKGROUND
  105. extern struct workq workq[];    // Work queue
  106.  
  107. struct msgstats {
  108.     int    msgbusy;                // Counts # of times msg received while busy
  109.     int unknown;                // Counts # of unidentified messages
  110.     int in;                        // Counts total # of messages received
  111.     int out;                    // Counts total of messages sent
  112.     int statusack;                // Counts # of status acks
  113. };
  114.  
  115. extern struct msgstats msgstats;
  116.  
  117. #endif
  118.  
  119.     //
  120.     // Structure to hold details of active machines. Both LAN and
  121.     // LANRES keep one of these. The LAN copy is updated from the
  122.     // LANRES copy.
  123.     //
  124.  
  125. struct lannode {
  126.     char cpName[D_NAMESZ];        // Name of machine
  127.     WORD wFlags;                // Flags that tell its status
  128. };
  129.  
  130. extern struct lannode lannode[];
  131.  
  132. extern char cpNRSL[];            // String that defines what's loaded
  133.                                 // on this node.
  134.  
  135.     //
  136.     // Message buffer types for the LAN program
  137.     // Must not conflict with MBT_* defined in NOS.H
  138.     //
  139.  
  140. #define MBT_base            100        // Start of message # range
  141. #define MBT_LANtext            100        // Plain text message
  142. #define MBT_LANwarmboot        101           // Warm reboot message
  143. #define MBT_LANcoldboot        102        // Cold reboot message
  144. #define MBT_LANstatus        103        // Send status enquiry message
  145. #define MBT_LANsend            104        // Broadcast message
  146. #define MBT_LANstatusack    106        // Response to status enquiry
  147. #define MBT_LANunknown        107        // Unknown message
  148. #define MBT_LANbootack        108        // Acknowledgement of boot message
  149. #define MBT_LANbootden        109        // Denial of boot request
  150.  
  151. #define    WARMBOOT    0x1234             // Special codes to identify boot types
  152. #define    COLDBOOT    0
  153.  
  154. #define D_WORKITEMS            8        // # of work items allowed for
  155.  
  156.     // TesSeract related declarations
  157.         
  158. extern WORD    TSRid;                    // Unique TSR id code
  159. extern char *TSRIdStr;                // TSR id string for TesSeRact
  160.  
  161.